import type { Metadata } from "next"; import Link from "next/link"; import { EventRow } from "@/components/market/event-row"; import { InstrumentTable } from "@/components/market/instrument-table"; import { Empty, Page, PageHeader, Section, Stat } from "@/components/ui/section"; import { StatusBadge } from "@/components/ui/status-badge"; import { api } from "@/lib/api"; import type { Breadth, Country, Exchange, ExchangeStatus, InstrumentWithQuote, MarketEvent } from "@/lib/types"; interface Detail { country: Country; exchanges: Array; indices: InstrumentWithQuote[]; rates: InstrumentWithQuote[]; fx: InstrumentWithQuote[]; equities: InstrumentWithQuote[]; breadth: Breadth | null; events: MarketEvent[]; instruments_tracked: number; } export const dynamic = "force-dynamic"; export async function generateMetadata({ params }: { params: Promise<{ code: string }> }): Promise { const { code } = await params; try { const d = await api(`/v1/countries/${encodeURIComponent(code)}`); return { title: `${d.country.name} — markets`, description: `${d.country.name}: exchanges, indices, rates, ${d.country.currency ?? "currency"} pairs and the equities Market Atlas observes.`, alternates: { canonical: `/countries/${d.country.code}` } }; } catch { return { title: "Country" }; } } export default async function CountryPage({ params }: { params: Promise<{ code: string }> }) { const { code } = await params; const d = await api(`/v1/countries/${encodeURIComponent(code)}`); const c = d.country; const open = d.exchanges.filter((e) => e.status.state === "OPEN").length; return ( Countries · {c.region} } title={c.name} lead={`${c.currency ? `Currency ${c.currency} · ` : ""}${d.exchanges.length} venue${d.exchanges.length === 1 ? "" : "s"} in the atlas · ${d.instruments_tracked.toLocaleString("en-US")} instruments tracked.`} />
{d.exchanges.length ? (
    {d.exchanges.map((e) => (
  • {e.name}
    {e.status.localTime} local · {e.mic ?? e.id}
  • ))}
) : ( No venue of {c.name} is in the atlas yet. )}
{d.indices.length > 0 && (
)}
{d.events.length ? (
    {d.events.map((e) => ( ))}
) : ( No events touching {c.name} instruments yet. )}
); }